//
//  UIColor+Ext.swift
//  MasterBoy
//
//  Created by kyson on 2023/3/29.
//

import Foundation

import UIKit


public extension UIColor {
    
    convenience init(colorHex hex: UInt) {
        self.init(red: CGFloat((hex & 0xFF0000) >> 16) / 255,
                  green: CGFloat((hex & 0x00FF00) >> 8) / 255,
                  blue: CGFloat(hex & 0x0000FF) / 255, alpha: 1)
    }
    
    convenience init(colorHex hex: UInt, alpha: Float) {
        self.init(red: CGFloat((hex & 0xFF0000) >> 16) / 255,
                  green: CGFloat((hex & 0x00FF00) >> 8) / 255,
                  blue: CGFloat(hex & 0x0000FF) / 255, alpha: CGFloat(alpha))
    }
}
